//
//  Double+roundTo.swift
//  MobileRTCSwiftSample
//
//  Created by zhangheng on 2019/9/20.
//  Copyright © 2019 Zoom Video Communications, Inc. All rights reserved.
//

import Foundation

// 保留的小数个数
extension Double {
    /// Rounds the double to decimal places value
    func roundTo(places:Int) -> Double {
        let divisor = pow(10.0, Double(places))
        return (self * divisor).rounded() / divisor
    }
    
}
